package control;

import java.io.File;

import data.PDMNode;
import data.PDMStructure;

public class TestPDMParser {
	
	
	public static void main (String [] args ){
		PDMStructure pdmStructure = new PDMStructure();
		PDMInputParser.parsePDMInput(new File("PDMInputExample1"), pdmStructure);
		
		for (String key : pdmStructure.getPdmNodes().keySet()){
			PDMNode node = pdmStructure.getPdmNodes().get(key);
			System.out.println("Task id  : " +node.getNodeKey());
			System.out.println("Duration : " +node.getDuration());
			System.out.println("Dependencies ");
				for (PDMNode nodeDependencies : node.getDependancies()){
					System.out.println("    "+nodeDependencies.getNodeKey());
					
				}
				System.out.println("Dependants ");
				for (PDMNode nodeDependents : node.getDependents()){
					System.out.println("    "+nodeDependents.getNodeKey());
				}
				System.out.println("-----------------------------------------");
		}
		
		
		PDMLink temp = new PDMLink();
		PDMLink.initForward(pdmStructure.getPdmNodes());
		System.out.println("\n");
		PDMLink.setNumbersForward(pdmStructure.getPdmNodes());
		System.out.println("\n");
		PDMLink.initBackward(pdmStructure.getPdmNodes());
		//System.out.println("\n");
		PDMLink.setNumbersBackward(pdmStructure.getPdmNodes());
		
		temp.getCriticalPath(pdmStructure.getPdmNodes());
	}

}
